//package com.bwie.car.util;
//
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
//@ControllerAdvice
//public class GlobalExceptionHandler {
//
//    @ExceptionHandler(RuntimeException.class)//捕获运行时异常
//    @ResponseBody
//    public Map<String,Object> exceptionHandler(HttpServletRequest request, Exception e){//处理异常方法
//        Map<String,Object> map=new HashMap<String, Object>();
//        map.put("errorCode","101");
//        map.put("errorMsg","已捕获到全局异常,系统错误！");
//        map.put("requestURL", request.getRequestURL().toString()); // 获取请求的URL
//        map.put("exception", e.getMessage()); // 获取异常的消息（可能不是具体原因）
//        return map;
//    }
//}
